package com.hxm.demo.test2;

import java.lang.reflect.Method;
import java.util.ArrayList;

public class staticTest {

    public static void main(String[] args) throws Exception {
        GT<Integer> gti = new GT<>();
        gti.var = 1;
        GT<String> gts = new GT<>();
        gts.var = 2;
        System.out.println(gti.var);
        staticTest.test();
    }

    public static void test() throws Exception {
        ArrayList<Integer> list = new ArrayList<Integer>();
        Method method = list.getClass().getMethod("add", Object.class);
        method.invoke(list, "Java反射机制实例");
        System.out.println(list.get(0));
    }
}

class GT<T> {
    public static int var = 8;

    public void nothing(T x) {
    }

}